package javaDB;

import java.io.File;

public class TfDB {
	public TfDB() {
		loadDatabaseDriver(DBProps.derbyDriver);
	      System.out.println("HOME: "+System.getProperty("DERBY_HOME"));

	}

	private void loadDatabaseDriver(String driverName) {
		// load Derby driver
		try {
			Class.forName(driverName);
		} catch (ClassNotFoundException ex) {
			ex.printStackTrace();
		}

	}
	   private boolean dbExists() {
	        boolean bExists = false;
	        String dbLocation = getDatabaseLocation();
	        File dbFileDir = new File(dbLocation);
	        if (dbFileDir.exists()) {
	            bExists = true;
	        }
	        return bExists;
	    }
	   
	   public String getDatabaseLocation() {
		   String dbLocation = System.getProperty("derby.system.home") + "/" + dbName;
	        return dbLocation;
	    }

	private String dbName = "tfDB";
}
